IF EXISTS ( SELECT 'X' FROM sys.views WHERE name = 'vLogonActivity' AND schema_id = 1 )
BEGIN
     DROP VIEW dbo.vLogonActivity
END
GO

CREATE VIEW dbo.vLogonActivity

AS
/*
 *
 * vLogonActivity
 *
 * Purpose:      
 *
 * Inputs:       
 *
 * Assumes:      
 *
 * Effects:      
 *
 * Returns:      
 *
 * Calling
 * Application:  
 *
 * Note(s):      
 *
 * Author(s):    NOVA Concepts Ltd.
 *
 * Change Log:   Initial Release, 05/30/2009, 1.00.0000
 *
 */
SELECT LoginActivityId  = EventLogId,
       LoginActivityDt  = MiscDt1,
       HostName,
       AppName,
       LoginName,
       LoginSID         = [SID],
       IsPooledFlag     = CONVERT( tinyint, MiscTinyint1 ),
       NetTransport     = MiscVC1,
       NetAddress       = MiscVC2,
       SPID
FROM   dbo.EventLog 
WHERE  LogByApp          = 'LogAllLogon'
AND    LogByAppSubSystem = 'InsLogonActivity'
GO
